const { defineConfig } = require('@vue/cli-service')
const path = require("path");
function resolve(dir) {
    return path.resolve(__dirname, dir);
}
module.exports = defineConfig({
  transpileDependencies: true,
  
  lintOnSave: false,
  //跨域配置
  devServer: {
    port: 8989, // 端口号
    https: false,
        open:true,
        proxy: {
            '/api': {//以/java开头的地址会被替换成下面的target，/java本身会被重写成下面的pathRewrite
                target: 'http://localhost:7090/api',  // 后台api
                changeOrigin: true,  //是否跨域
                // secure: true,
                pathRewrite: {
                    '^/api': '/'   //需要rewrite的, 
                }
            }
        }
    },
    //@路径配置
    chainWebpack: config => {
      config.resolve.alias
          .set("@", resolve('src'))
          .set("assets", resolve("src/assets"))
          .set("components", resolve("src/components"))
          .set("base", resolve("baseConfig"))
          .set("public", resolve("public"));
  },
})
